﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Hi_Baidu.Packet.InPacket.TalkInPacket
{
    class WindowShadowPacket : TalkMessageInPackage
    {
        public WindowShadowPacket(TalkMessageInPackage inpackage)
            : base(inpackage)
        {
        }

        public override void InitPackage()
        {
            int Offset = 0;
            byte[] UsernameLength = new byte[4];
            Array.ConstrainedCopy(this.Body["HEAD"], Offset, UsernameLength, 0, 4);
            Offset += 4;
            byte[] Username = new byte[BitConverter.ToInt32(UsernameLength, 0)];
            Array.ConstrainedCopy(this.Body["HEAD"], Offset, Username, 0, Username.Length);
            Offset += Username.Length;

            this.DIC_CONTENT.Add("USERNAME", Username);
        }

        /// <summary>
        ///     获得当前会话ID
        /// </summary>
        /// <returns></returns>
        public String GetSession()
        {
            return Encoding.Default.GetString(this.Body["SESSIONCODE"]);
        }
    }
}
